<html>
<head>
    <link href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctx}/css/index.css" rel="stylesheet">
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <script src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.js"></script>

    <style>
        * {
            font-size: 12px;
        }

        [class^="col-"] {
            vertical-align: middle;
            line-height: 34px;
            min-height: 34px;
            margin-bottom: 12px;
        }

        .form-control {
            margin: 0;
        }

        .form-control-static {
            min-height: 34px;
            padding: 0;
            margin-bottom: 0;
        }

        .align-right {
            text-align: right;
        }

        input {
            padding-left: 15px;
        }
    </style>

</head>
<body style="height: 380px; overflow-y: hidden;overflow-x: hidden;">
<#if user??>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">ID：</div>
    <div class="col-xs-6">
        <p class="form-control-static">${user.userId}</p>
    </div>
</div>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">用户名：</div>
    <div class="col-xs-6">
        <p class="form-control-static">${user.username}</p>
    </div>
</div>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">昵称：</div>
    <div class="col-xs-6">
        <input class="form-control" id="nickname" value="<#if user??>${user.nickname}</#if>">
    </div>
</div>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">姓名：</div>
    <div class="col-xs-6">
        <input class="form-control" id="realname" value="<#if user??>${user.realname}</#if>">
    </div>
</div>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">电话：</div>
    <div class="col-xs-6">
        <input class="form-control" id="phone" value="<#if user??>${user.phone}</#if>">
    </div>
</div>
<div class="row">
    <div class="col-xs-2 col-xs-offset-2 align-right">邮箱：</div>
    <div class="col-xs-6">
        <input class="form-control" id="email" value="<#if user??>${user.email}</#if>">
    </div>
</div>
<div class="row">
    <div class="col-xs-6 col-xs-offset-4">
        <button id="save_btn" type="button" class="btn btn-primary">保存</button>
    </div>
    </row>
    </#if>
    <script>
        $(function () {
            $("#save_btn").click(function () {
                if (confirm("确定保存？")) {
                    $.post("/user/save", {
                        userId: <#if user?? && user.userId??>'${user.userId}'<#else>''</#if>,
                        username: <#if user?? && user.username??>'${user.username}'<#else>''</#if>,
                        nickname: $("#nickname").val(),
                        realname: $("#realname").val(),
                        phone: $("#phone").val(),
                        email: $("#email").val()
                    }, function (res) {
                        alert(res);
                        window.parent.iw.closeDialog();
                    });
                }
            });
        });
    </script>
</body>
</html>
